<!DOCTYPE html>
<html lang="zh">

	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta http-equiv="X-UA-Compatible" content="ie=edge" />
		<link rel="stylesheet" type="text/css" href="img-font/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="css/app.css" />
		<link rel="stylesheet" type="text/css" href="css/swiper-3.4.2.min.css" />
		<script src="js/jquery.min.js"></script>
		<script src="js/swiper-3.4.2.jquery.min.js"></script>
		<link rel="stylesheet" type="text/css" href="css/weui.css" />
		<!--		<link rel="stylesheet" type="text/css" href="css/css.css" />
-->
		<link rel="stylesheet" type="text/css" href="css/release.css" />
		<script src="js/main.js"></script>
		<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
		<script src="js/Url.js"></script>
		<title></title>
	</head>
	<style type="text/css">
		.prompt {
			width: 100%;
			line-height: 24px;
			border-top: 1px solid #666;
			text-align: center;
			display: none;
			margin-bottom: 30px;
			color: #666;
		}
		
		.po-avt {
			border-radius: 50%;
		}
		
		.post .post-img {
			padding: 10px 5px 0 0;
			display: block;
			max-height: 293px;
			max-width: 130px;
		}
		
		.alTime {
			font-size: 10px;
			color: #BBB;
			position: relative;
		}
		
		.alTime img {
			position: absolute;
			top: -10px;
			left: 60%;
			width: 30px;
		}

		.alTime_2 {
			font-size: 10px;
			color: #BBB;
			position: relative;
		}

		.alTime_2 img {
			position: absolute;
			top: -10px;
			left: 60%;
			width: 30px;
		}

		.centent .texts {
			text-align: center;
			color: #666;
			font-size: 16px;
		}
	</style>

	<body>
		<div class="home">
			<div class="swiper-container">
				<div class="swiper-wrapper">
				</div>
				<div class="swiper-pagination"></div>
			</div>
			<div class="xian">
				<div class="ggz"> 广告主 </div>
			</div>
			<div class="centent">
				<div class="texts"></div>
				<div class="imges">
					<div id="main">
						<div id="list">
							<ul id="list-container">
						</div>
					</div>
					<div class="fabu">
						<a href="#" onclick="ction()" style="display: block; width: 100%; height: 100%;"></a>
					</div>
				</div>
				<div class="prompt">
					别拉了，我也是有底线的！
				</div>

				<footer>
					<div class="footers">
						<div class="tab2 yangs">
							<a href="/footballgame/index.html" class="indexs" style="background:url(images/play.png) center center no-repeat;
	background-size: 35% 100%;"></a>
						</div>
						<div class="tab3 yangs">
							<a href="release.html" class="indexs_2" style="background:url(images/ad_1.png) center center no-repeat;
	background-size: 35% 100%;"></a>
						</div>
						<div class="tab5 yangs">
							<a href="QR-code.html" class="indexs_3" style="background:url(images/code.png) center center no-repeat;
	background-size: 35% 100%;"></a>
						</div>
						<div class="tab4 yangs">
							<a href="income.html" class="indexs_5" style="background:url(images/my.png) center center no-repeat;
	background-size: 35% 100%;"></a>
						</div>
					</div>
				</footer>
			</div>
		</div>
	</body>

</html>
<script src="js/weui.min.js"></script>
<script>
	var startPage = 1;

	function getLocalTime(nS) {
		return new Date(parseInt(nS) * 1000).toLocaleString().substr(0, 14)
	}
	//	console.log(new Date(1503645631000).toLocaleString());

	var lable = true;

	var i = 1;

	function isBottom() {
		var scrollHeight = document.documentElement.scrollHeight ? document.documentElement.scrollHeight : document.body.scrollHeight;
		var scrollTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
		var clientHeight = document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;

		if((scrollTop + clientHeight) >= (scrollHeight - 50)) {
			judge();

		}

	}
	$(window).scroll(function() {
		this.isBottom();
	});
	isBottom();

	function read(Old) {
		console.log(Old)
		for(var i = 0; i <= Old.length; i++) {
			var str = '';
			str += '<li>';
			str += '<div class="po-avt-wrap">';
			str += '<img class="po-avt data-avt" src="' + Old[i].headImgurl + '">';
			str += '</div>';
			str += '<div class="po-cmt">';
			str += '<a href="person.html?openid=' + Old[i].openId + '">';
			str += '<div class="po-hd"> ';
			if(Old[i].gitMoney == 1) {
				str += '<p class="po-name"><span class="data-name">' + Old[i].nickName + '<img class="imgs" src="images/zs.png" width="50px" heigth="40px"/></span></p>';
			} else {
				str += '<p class="po-name"><span class="data-name">' + Old[i].nickName + '</span></p>';
			}
			str += '<p class="alTime">' + new Date((Old[i].createTime)).toLocaleString() + '<img src="images/yyue.png" width="100%"/></p>';
			str += '</a>';
			str += '<a href="Ad-Details.html?id=' + Old[i].id + '">';
			str += '<div class="post">';
			str += '<p>' + Old[i].advertContent + '</p>';
			str += '<p class="Ops">';
			for(var j = 0; j < Old[i].advertImgUrl.length; j++) {
				if(Old[i].advertImgUrl.length == 1) {
					str += '<img class="post-img" src="' + baseUrl + Old[i].advertImgUrl[j].imgUrl + '">';
				} else {
					str += '<img class="list-img" src="' + baseUrl + Old[i].advertImgUrl[j].imgUrl + '">';
				}

			}

			str += '</p>';
			str += '</div>';
			str += '<p class="time">浏览<span>' + Old[i].advertClick + '</span>次</p>';
			str += '</div>';
			str += '</a>';
			str += '<div class="r"></div>';
			str += '</div>';
			str += '</li>';
			$('#list-container').append(str);

		}
	}

	function rendering(parameter) {

		for(var i = 0; i < parameter.length; i++) {
			if(parameter[i].status == 0) {
				var str = '';
				str += '<li>';
				str += '<div class="po-avt-wrap">';
				str += '<a href="person.html?openid=' + parameter[i].openId + '">';
				str += '<img class="po-avt data-avt" src="' + parameter[i].headImgurl + '">';
				str += '</div>';
				str += '<div class="po-cmt">';
				str += '<div class="po-hd"> ';
				if(parameter[i].gitMoney == 1) {
					str += '<p class="po-name"><span class="data-name">' + parameter[i].nickName + '<img class="imgs" src="images/zs.png" width="50px" heigth="40px"/></span></p>';
				} else {
					str += '<p class="po-name"><span class="data-name">' + parameter[i].nickName + '</span></p>';
				}
				str += '<p class="alTime_2">' + new Date((parameter[i].createTime)).toLocaleString() + '</p>';
				str += '</a>';
				str += '<a href="Ad-Details.html?id=' + parameter[i].id + '">';
				str += '<div class="post">';
				str += '<p>' + parameter[i].advertContent + '</p>';
				str += '<p class="Ops">';
				for(var j = 0; j < parameter[i].advertImgUrl.length; j++) {
					if(parameter[i].advertImgUrl.length == 1) {
						str += '<img class="post-img" src="' + baseUrl + parameter[i].advertImgUrl[j].imgUrl + '">';
					} else {
						str += '<img class="list-img" src="' + baseUrl + parameter[i].advertImgUrl[j].imgUrl + '">';
					}

				}
				str += '</p>';
				str += '</div>';
				str += '<p class="time">浏览<span>' + parameter[i].advertClick + '</span>次</p>';
				str += '</div>';
				str += '</a>';
				str += '<div class="r"></div>';
				str += '</div>';
				str += '</li>';
				$('#list-container').append(str);
			}
		}

	}

	function judge() {

		if(lable === false) {
			return;
		};
		lable = false;
		$.ajax({
			type: "get",
			url: baseUrl + "foot/advert/getAdvert",
			data: {
				'startPage': startPage
			},
			success: function(res) {
				console.log(res)
				if(res.error_code == 0) {
					if(res.data.notValue == null) {
						console.log(null)
						if(res.data.value == null) {
							lable = false;
						} else if(res.data.value.length < 5) {
							read(res.data.value);
							$('.prompt').show();
							$('.prompt').html('加载中...');
							var setin = setInterval(function() {
								var today = new Date();
								$('.prompt').html('没有更多了...');
								clearInterval(setin)

							}, 3000);
							lable = false;

						} else {
							startPage += 1;
							lable = true;
							$('.prompt').show();
							$('.prompt').html('加载中...');
							var setin = setInterval(function() {
								var today = new Date();
								$('.prompt').html('没有更多了...');
								clearInterval(setin)

							}, 3000);
							read(res.data.value.value);
						}
						//						rendering(res.data.value);
					} else if(res.data.notValue.length < 5) {
						rendering(res.data.notValue.value);
						$('.prompt').show();
						$('.prompt').html('加载中...');
						var setin = setInterval(function() {
							var today = new Date();
							$('.prompt').html('没有更多了...');
							clearInterval(setin)

						}, 3000);
						lable = false;

					} else {
						rendering(res.data.notValue.value);
						startPage += 1;
						$('.prompt').show();
						$('.prompt').html('加载中...');
						var setin = setInterval(function() {
							var today = new Date();
							$('.prompt').html('没有更多了...');
							clearInterval(setin)

						}, 3000);
						lable = true;
					}
				}

			}
		});
	}

	$(function() {
		$.ajax({
			type: "get",
			url: baseUrl + "foot/manager/getCarouselFigure",
			contentType: "application/json; charset=utf-8",
			success: function(data) {
				for(var j = 0; j < data.data.value.length; j++) {
					var sta = '';
					sta += '<a href="' + data.data.value[j].imgContent + '"><div class="swiper-slide" class="lonbo"><img src="' + baseUrl + '/' + data.data.value[j].imgUrl + '" width="100%" /></a>';
					sta += '</div>';
					$('.swiper-wrapper').append(sta);
				}
				var mySwiper = new Swiper('.swiper-container', {
					autoplay: 1500, //可选选项，自动滑动
					pagination: '.swiper-pagination',
					loop: true
				});
			}
		});
	})

	function ction() {
		window.location.href = 'subpage/fabu.html';
	}
</script>
<script>
	var Url = baseUrl + "/release.html";
	$.ajax({
		url: '/wechat/getweixinjs',
		data: {
			url: Url
		},
		type: 'get',
		dataType: 'json',
		success: function(res) {
			wx.config({
				debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
				appId: res.data.appId, // 必填，公众号的唯一标识
				timestamp: res.data.timestamp, // 必填，生成签名的时间戳
				nonceStr: res.data.nonceStr, // 必填，生成签名的随机串
				signature: res.data.signature, // 必填，签名，见附录1
				jsApiList: ["hideMenuItems"] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
			});
		}
	})

	wx.ready(function() {
		hideMenu();
	});
	wx.error(function(res) {

	});

	function hideMenu() {
		wx.hideMenuItems({
			menuList: ["menuItem:share:email", "menuItem:copyUrl", "menuItem:share:appMessage", "menuItem:share:timeline", "menuItem:favorite", "menuItem:openWithQQBrowser", "menuItem:openWithSafari", "menuItem:share:qq", "menuItem:share:QZone"]
		});
	}
</script>